jQuery.extend({ 
	ajaxEx: function (obj) {
		var markShadow=jQuery("<div id='markShadow' class='window-mask tree-loading' style='z-index: 9999999;background-color: black; display: none;'></div>");
		jQuery(document.body).append(markShadow);
		markShadow.fadeIn(800);
		var opts ={
				type : obj.type,
				url : obj.url,
				data : obj.data,
				dataType : obj.dataType,
				success : function(data) {
					obj.success(data);
				},
				error : ajaxError,
				complete: function(d) {
					$("#markShadow").remove();
				}
			};
		if(obj.contentType)
			opts.contentType = obj.contentType;
		if(obj.async)
			opts.async = obj.async;
		$.ajax(opts);
	}
}); 

ajaxError = function(XMLHttpRequest, textStatus, errorThrown){
	var status=XMLHttpRequest.status;
	if(status == '1000'){   //登陆超时
		$.messager.alert('登陆超时','登陆超时','info',function(){
			 location.reload();
		 window.location.href = '/testSpringMVC/login/noLogin.do';
			//self.location.reload();
		});
	}else if(status == '1001'){       //没有权限
		$.messager.alert('提示', '存在未知或无权限访问的路径');
	}else if(status == '0'){                            //服务停止
		$.messager.alert('提示', '服务器拒绝了连接');
	}else{
		$.messager.alert('提示', '操作失败！<br />' + errorThrown, 'error');
	}
}

document.onkeydown = function(e) {
	event = event||e;
	var obj = event.srcElement||event.target;
	_search(obj,event.keyCode == 13);
}
var _search = function(sr,isEnter) {
	if(isEnter)
		while(sr.parentNode) {
			sr=sr.parentNode;
			if(sr.tagName=="HTML")
				return false;
			if(sr.getAttribute("search")) {
				eval(sr.getAttribute("search")+"()");
				return true;
			}
		}
	return false;
}
$.fn.combobox.methods = jQuery.extend($.fn.combobox.methods,{focus:function(jq){
	return jq.each(function(){
	$(this).combobox('showPanel');
	$(this).combobox('textbox').focus();
	});
}})